package com.king.base.service.alipay;

import com.baomidou.mybatisplus.extension.service.IService;
import com.king.base.domain.alipay.AliPay;
import com.king.base.domain.menu.vo.TradeVo;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;

/**
 * @author TianYZ
 * @date 2019-06-16
 */
@CacheConfig(cacheNames = "alipay")
public interface AlipayService extends IService<AliPay>{

    /**
     * 处理来自PC的交易请求
     * @param alipay
     * @param trade
     * @return
     * @throws Exception
     */
    String toPayAsPC(AliPay alipay, TradeVo trade) throws Exception;

    /**
     * 处理来自手机网页的交易请求
     * @param alipay
     * @param trade
     * @return
     * @throws Exception
     */
    String toPayAsWeb(AliPay alipay, TradeVo trade) throws Exception;

    /**
     * 查询配置
     * @return
     */
    @Cacheable(key = "'1'")
    AliPay find();

    /**
     * 更新配置
     * @param aliPay
     * @return
     */
    @CachePut(key = "'1'")
    AliPay update(AliPay aliPay);
}
